<?php
/**
 * Created by PhpStorm.
 * User: Kevin
 * Date: 2019/4/19
 * Time: 17:56
 */
namespace app\admin\controller;
use org\Qiniu;
class Demo extends Base
{
    public function index(){
        $photo = "/uploads/images/20190420/3d199f40888364c4bd68eb4ecdf5831b.png,/uploads/images/20190420/3d199f40888364c4bd68eb4ecdf5831b.png,/uploads/images/20190420/3d199f40888364c4bd68eb4ecdf5831b.png";
        return $this->fetch('demo/index',['photo'=>$photo]);
    }

    /**
     * 生成七牛云分片上的token
     * @return \think\response\Json
     */
    public function uptoken(){
        $up = new Qiniu();
        $auth = $up->auth();
        //储存空间
        $bucket = config('qiniu.bucket');
        // 生成上传Token
        $uptoken = $auth->uploadToken($bucket);
        return json(['domain'=>'http://ppd5mwq7x.bkt.clouddn.com','uptoken'=>$uptoken]);
    }
}